1. Field of the Invention
This invention relates to a data encoding apparatus, a data decoding apparatus, a data encoding method, a data decoding method, and a recording medium recorded with a program, which are used to encode or decode data by dividing the data into a variable length code part and a fixed length code part.
2. Description of Related Art
In an image capturing apparatus such as a digital camera, image capturing data known as RAW data are recorded onto a recording medium in single lens reflex type models and the like, for example. These RAW data are obtained through the implementation of simple analog processing on an image signal obtained from an image capturing element, followed by conversion into digital data. In recent years, the number of pixels in the image capturing element of a digital camera has increased, leading to an increase in the data size of the RAW data. Accordingly, digital cameras which perform compression processing on the RAW data to reduce the size of the data also exist. However, it is assumed that the RAW data will be retouched by a user, and therefore when compression processing is performed, it is desirable that the compression processing be lossless compression.
It is generally desirable for a compression method to have a high compression ratio, but in the case of a compression method applied to an image capturing apparatus such as a digital camera, in contrast to a compression method applied to a single personal computer or the like, several additional requirements, such as the following, for example, arise due to specification limitations and the like.    (1) The processing time should be short.    (2) The buffer amount required for the processing should be small.
Requirement (1) relates to continuous shooting performance, battery consumption, and so on, for example. Requirement (2) relates to the cost, size, weight, and so on of the digital camera.
However, attempts to satisfy both requirement (1) and requirement (2) result in the increased likelihood of a deterioration in the compression performance.
U.S. Pat. No. 5,764,374, for example, may be cited as a compression technique proposed in the prior art. U.S. Pat. No. 5,764,374 proposes a method of classifying conditions according to the gradient of the peripheral pixels of an encoding target pixel and setting a k parameter during Golomb-Rice encoding in the respective conditions.
However, with the technique described in U.S. Pat. No. 5,764,374, a table of the appearance frequency and accumulated error must be created for each condition before calculation processing is performed, leading to an increase in buffer use, and hence the aforementioned requirement (2) is not sufficiently satisfied. Furthermore, the conditions of the peripheral pixels are divided in relation to the encoding target pixel, leading to an increase in processing, and hence requirement (1) is not sufficiently satisfied either.